home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 14 / CU Amiga Magazine's Super CD-ROM 14 (1997)(EMAP Images)(GB)(Track 1 of 3)[!][issue 1997-09].iso / CUCD / Programming / IEditor / Generators / E / code_misc.c < prev    next >
Encoding:
C/C++ Source or Header  |  1997-06-17  |  17.0 KB  |  525 lines

  1. /// Includes
  2. #define INTUI_V36_NAMES_ONLY
  3.  
  4. #include <exec/nodes.h>                 // exec
  5. #include <exec/lists.h>
  6. #include <exec/types.h>
  7. #include <dos/dos.h>                    // dos
  8. #include <dos/dostags.h>
  9. #include <intuition/intuition.h>        // intuition
  10. #include <clib/exec_protos.h>           // protos
  11. #include <clib/dos_protos.h>
  12. #include <pragmas/exec_pragmas.h>       // pragmas
  13. #include <pragmas/dos_pragmas.h>
  14.  
  15. #include <string.h>
  16. #include <stdio.h>
  17. #include <stdlib.h>
  18. #include <ctype.h>
  19.  
  20. #include "DEV_IE:Generators/defs.h"
  21. #include "DEV_IE:Include/IEditor.h"
  22. #include "DEV_IE:Generators/C/Protos.h"
  23. ///
  24.  
  25.  
  26. /// WriteMain
  27. void WriteMain( struct GenFiles *Files, struct IE_Data *IE )
  28. {
  29.     struct LibNode     *lib;
  30.     struct WndToOpen   *wto;
  31.     BOOL               bool;
  32.  
  33.     FPrintf( Files->Main,
  34.     "MODULE 'dos/dos', 'exec/libraries', 'exec', 'dos', '%s'\n",
  35.     FilePart( Files->XDefName ));
  36.  
  37.     if( IE->ExtraProc[0] ) {
  38.  
  39.     if( IE->C_Prefs & GEN_TEMPLATE ) {
  40.         FPrintf( Files->Temp,
  41.         "PROC %s()\n"
  42.         "\t/*  ...Initialization Stuff...  */\n"
  43.         "ENDPROC\n",
  44.         IE->ExtraProc );
  45.     }
  46.     }
  47.  
  48.     if( IE->MainProcFlags & MAIN_OTHERBITS ) {
  49.  
  50.     if( IE->C_Prefs & GEN_TEMPLATE ) {
  51.         FPuts( Files->Temp,
  52.         "PROC handleOtherSignals()\n"
  53.         "\t/*  Routine to handle other signals  */\n"
  54.         "\tRETURN TRUE\n"
  55.         "ENDPROC\n" );
  56.     }
  57.     }
  58.  
  59.  
  60.     FPuts( Files->Main, "\nDEF\tok_to_run=TRUE, mask=NIL\n\n" );
  61.  
  62.  
  63.  
  64.     FPuts( Files->Main,
  65.     "\nPROC main() HANDLE\n"
  66.     "\tIF ( openLibs() = FALSE ) THEN Raise( 1 )\n"
  67.     "\tIF ( setup() = FALSE ) THEN Raise( 1 )\n" );
  68.  
  69.     if( IE->ExtraProc[0] )
  70.     FPrintf( Files->Main, "\tIF ( %s() = FALSE ) THEN Raise( 1 )\n", IE->ExtraProc );
  71.  
  72.     FPuts( Files->Main,
  73.     "\tplayTheGame()\n"
  74.     "EXCEPT DO:\n"
  75.     "\tend()\n"
  76.     "ENDPROC 0\n"
  77.     "\n"
  78.     "PROC end()\n"
  79.     "\tcloseAll()\n"
  80.     "\tcloseLibs()\n"
  81.     "ENDPROC\n"
  82.     "\n"
  83.     "PROC openLibs()\n" );
  84.  
  85.     for( lib = IE->Libs_List.mlh_Head; lib->lbn_Node.ln_Succ; lib = lib->lbn_Node.ln_Succ ) {
  86.     if ( lib->lbn_Node.ln_Pri & L_FAIL )
  87.         FPrintf( Files->Main,
  88.              "\tIF ( %s:= OpenLibrary( \"%s\", %ld )) = NIL THEN\n"
  89.              "\t\terror( errstrings[ OPEN_LIB ], \"%s\" )\n"
  90.              "\t\tRETURN FALSE\n"
  91.              "\tENDIF\n",
  92.              lib->lbn_Base, lib->lbn_Name, lib->lbn_Version, lib->lbn_Name );
  93.     else
  94.         FPrintf( Files->Main,
  95.              "\t%s:= OpenLibrary( \"%s\", %ld )\n",
  96.              lib->lbn_Base, lib->lbn_Name, lib->lbn_Version );
  97.     }
  98.  
  99.     FPuts( Files->Main,
  100.        "ENDPROC TRUE\n"
  101.        "\n"
  102.        "PROC setup()\n"
  103.        "\tDEF\tret\n" );
  104.  
  105.     if( IE->SrcFlags & OPENDISKFONT ) {
  106.     struct TxtAttrNode *fnt;
  107.  
  108.     bool = FALSE;
  109.     for( fnt = IE->FntLst.mlh_Head; fnt->txa_Next; fnt = fnt->txa_Next )
  110.         if( fnt->txa_Flags & FPB_DISKFONT )
  111.         bool = TRUE;
  112.  
  113.     if( bool )
  114.         FPuts( Files->Main,
  115.            "\tIF openDiskFonts() = FALSE THEN\n"
  116.            "\t\terror( errstrings[ OPEN_FONTS ], NULL )\n"
  117.            "\t\tRETURN FALSE\n"
  118.            "\tENDIF\n" );
  119.     }
  120.  
  121.     FPuts( Files->Main,
  122.        "\tIF ( ret:= setupScreen()) THEN\n"
  123.        "\t\terror( errstrings[ SETUP_SCR ], errstrings[ SETUP_SCR+ret ]);\n"
  124.        "\t\tRETURN FALSE\n"
  125.        "\tENDIF\n" );
  126.  
  127.     for( wto = IE->WndTO_List.mlh_Head; wto->wto_Node.ln_Succ; wto = wto->wto_Node.ln_Succ )
  128.     FPrintf( Files->Main,
  129.          "\tIF ( ret = open%sWindow()) THEN\n"
  130.          "\t\terror( errstrings[ OPEN_WND ], errstrings[ OPEN_WND+ret ])\n"
  131.          "\t\tRETURN FALSE\n"
  132.          "\tENDIF\n",
  133.          wto->wto_Label );
  134.  
  135.     if( IE->NumRexxs )
  136.     FPuts( Files->Main, "\tsetupRexxPort()\n" );
  137.  
  138.     FPuts( Files->Main, "ENDPROC TRUE\n"
  139.             "\n"
  140.             "PROC closeAll()\n" );
  141.  
  142.     for( wto = IE->WndTO_List.mlh_Head; wto->wto_Node.ln_Succ; wto = wto->wto_Node.ln_Succ )
  143.     FPrintf( Files->Main, "\tclose%sWindow()\n", wto->wto_Label );
  144.  
  145.     FPuts( Files->Main, "\tcloseDownScreen()\n" );
  146.  
  147.     if(( IE->SrcFlags & OPENDISKFONT ) && ( bool ))
  148.     FPuts( Files->Main, "\tcloseDiskFonts()\n" );
  149.  
  150.     if( IE->NumRexxs )
  151.     FPuts( Files->Main, "\tdeleteRexxPort()\n" );
  152.  
  153.     FPuts( Files->Main, "ENDPROC\n\nPROC closeLibs()\n" );
  154.  
  155.     for( lib = IE->Libs_List.mlh_Head; lib->lbn_Node.ln_Succ; lib = lib->lbn_Node.ln_Succ )
  156.     FPrintf( Files->Main, "\tIF ( %s ) THEN CloseLibrary( %s )\n",
  157.          lib->lbn_Base, lib->lbn_Base );
  158.  
  159.     FPuts( Files->Main,
  160.        "ENDPROC\n\n"
  161.        "PROC playTheGame()\n"
  162.        "\tDEF signals,other = mask" );
  163.  
  164.     for( wto = IE->WndTO_List.mlh_Head; wto->wto_Node.ln_Succ; wto = wto->wto_Node.ln_Succ )
  165.     FPrintf( Files->Main, ",%s_signal = Shl( 1, %sWnd.userport.sigbit )",
  166.          wto->wto_Label, wto->wto_Label );
  167.  
  168.     if( IE->NumRexxs )
  169.     FPuts( Files->Main, ",rexx_signal=NIL;\n\n"
  170.                 "\tIF ( RexxPort ) THEN rexx_signal:= Shl( 1, rexxPort.sigbit )\n" );
  171.  
  172.     FPuts( Files->Main, "\n\tmask = mask" );
  173.  
  174.     if( IE->MainProcFlags & MAIN_CTRL_C )
  175.     FPuts( Files->Main, " | SIGBREAKF_CTRL_C" );
  176.  
  177.     for( wto = IE->WndTO_List.mlh_Head; wto->wto_Node.ln_Succ; wto = wto->wto_Node.ln_Succ )
  178.     FPrintf( Files->Main, " | %s_signal", wto->wto_Label );
  179.  
  180.     if( IE->NumRexxs )
  181.     FPuts( Files->Main, " | rexx_signal" );
  182.  
  183.     FPuts( Files->Main, "\n\n\tWHILE( ok_to_run )\n\t\tsignals := Wait( mask )\n" );
  184.  
  185.     for( wto = IE->WndTO_List.mlh_Head; wto->wto_Node.ln_Succ; wto = wto->wto_Node.ln_Succ )
  186.     FPrintf( Files->Main, "\t\tIF (signals AND %s_signal) THEN ok_to_run:= handle%sIDCMP()\n",
  187.          wto->wto_Label, wto->wto_Label );
  188.  
  189.     if( IE->NumRexxs )
  190.     FPuts( Files->Main, "\t\tIF (signals AND rexx_signal) THEN handleRexxMsg()\n" );
  191.  
  192.     if( IE->MainProcFlags & MAIN_OTHERBITS )
  193.     FPuts( Files->Main, "\t\tIF (signals AND other) THEN ok_to_run:= handleOtherSignals()\n" );
  194.  
  195.     if( IE->MainProcFlags & MAIN_CTRL_C )
  196.     FPuts( Files->Main, "\t\tIF (signals AND SIGBREAKF_CTRL_C) THEN ok_to_run:= FALSE\n" );
  197.  
  198.     FPuts( Files->Main, "\tENDWHILE\n\nENDPROC\n" );
  199. }
  200. ///
  201.  
  202. /// WriteSetupScr
  203. void WriteSetupScr( struct GenFiles *Files, struct IE_Data *IE )
  204. {
  205.     if( IE->SrcFlags & FONTSENSITIVE ) {
  206.  
  207.     FPuts( Files->XDef, "extern UWORD ScaleX( UWORD );\n"
  208.                 "extern UWORD ScaleY( UWORD );\n" );
  209.  
  210.     FPrintf( Files->Std, "\nUWORD ScaleX( UWORD value )\n"
  211.                  "{\n"
  212.                  "\treturn(( UWORD )((( FontX * value ) + %ld ) / %ld ));\n"
  213.                  "}\n"
  214.                  "\n"
  215.                  "UWORD ScaleY( UWORD value )\n"
  216.                  "{\n"
  217.                  "\treturn(( UWORD )((( FontY * value ) + %ld ) / %ld ));\n"
  218.                  "}\n"
  219.                  "\n"
  220.                  "static void ComputeFont( UWORD width, UWORD height )\n"
  221.                  "{\n"
  222.                  "\tFont = &Attr;\n"
  223.                  "\tFont->ta_Name = (STRPTR)Scr->RastPort.Font->tf_Message.mn_Node.ln_Name;\n"
  224.                  "\tFont->ta_YSize = FontY = Scr->RastPort.Font->tf_YSize;\n"
  225.                  "\tFontX = Scr->RastPort.Font->tf_XSize;\n"
  226.                  "\n"
  227.                  "\tXOffset = Scr->WBorLeft;\n"
  228.                  "\tYOffset = Scr->RastPort.TxHeight + Scr->WBorTop;\n"
  229.                  "\n"
  230.                  "\tif( width && height )\n"
  231.                  "\t\tif((( ScaleX( width ) + Scr->WBorRight ) > Scr->Width ) ||\n"
  232.                  "\t\t\t(( ScaleY( height ) + Scr->WBorBottom + YOffset ) > Scr->Height ))\n"
  233.                  "\t\t\t\t{\n"
  234.                  "\t\t\t\t\tFont->ta_Name = (STRPTR)\"topaz.font\";\n"
  235.                  "\t\t\t\t\tFontX = FontY = Font->ta_YSize = 8;\n"
  236.                  "\t\t\t\t}\n"
  237.                  "}\n",
  238.          IE->ScreenData->Screen->RastPort.Font->tf_XSize >> 1,
  239.          IE->ScreenData->Screen->RastPort.Font->tf_XSize,
  240.          IE->ScreenData->Screen->RastPort.Font->tf_YSize >> 1,
  241.          IE->ScreenData->Screen->RastPort.Font->tf_YSize );
  242.     }
  243.  
  244.     FPuts( Files->Std, "\nint SetupScreen( void )\n"
  245.                "{\n"
  246.                "\tif(!( Scr = " );
  247.  
  248.     if( IE->flags_2 & GENERASCR )
  249.     FPuts( Files->Std, "OpenScreenTagList( NULL, (struct TagItem *)ScreenTags" );
  250.     else
  251.     FPuts( Files->Std, "LockPubScreen( PubScreenName" );
  252.  
  253.     FPuts( Files->Std, " )))\n\t\treturn( 1L );\n\n" );
  254.  
  255.     if( IE->SrcFlags & FONTSENSITIVE )
  256.     FPuts( Files->Std, "\tComputeFont( 0, 0 );\n" );
  257.     else
  258.     FPuts( Files->Std, "\tYOffset = Scr->WBorTop + Scr->Font->ta_YSize;\n"
  259.                "\tXOffset = Scr->WBorLeft;\n" );
  260.  
  261.     FPuts( Files->Std, "\n\tif(!( VisualInfo = GetVisualInfo( Scr, TAG_DONE )))\n"
  262.                "\t\treturn( 2L );\n" );
  263.  
  264.     if(( IE->SrcFlags & SHARED_PORT ) && (!( IE->SharedPort[0] )))
  265.     FPuts( Files->Std, "\n\tif(!( IDCMPPort = CreateMsgPort() ))\n"
  266.                "\t\treturn( 3L );\n" );
  267.  
  268.     // Expanders
  269.     ( *IE->IEXSrcFun->Setup )( Files );
  270.  
  271.     FPuts( Files->Std, "\n"
  272.                "\treturn( 0L );\n"
  273.                "}\n\n"
  274.                "void CloseDownScreen( void )\n"
  275.                "{\n"
  276.                "\tif( VisualInfo ) {\n"
  277.                "\t\tFreeVisualInfo( VisualInfo );\n"
  278.                "\t\tVisualInfo = NULL;\n"
  279.                "\t}\n" );
  280.  
  281.     // Expanders
  282.     ( *IE->IEXSrcFun->CloseDown )( Files );
  283.  
  284.     FPuts( Files->Std, "\n\tif( Scr ) {\n\t\t" );
  285.  
  286.     if( IE->flags_2 & GENERASCR )
  287.     FPuts( Files->Std, "CloseScreen(" );
  288.     else
  289.     FPuts( Files->Std, "UnlockPubScreen( NULL," );
  290.  
  291.     FPuts( Files->Std, " Scr );\n"
  292.                "\t\tScr = NULL;\n"
  293.                "\t}\n" );
  294.  
  295.     if(( IE->SrcFlags & SHARED_PORT ) && (!( IE->SharedPort[0] )))
  296.     FPuts( Files->Std, "\tif( IDCMPPort ) {\n"
  297.                "\t\tDeleteMsgPort( IDCMPPort );\n"
  298.                "\t\tIDCMPPort = NULL;\n"
  299.                "\t}" );
  300.  
  301.     FPuts( Files->Std, "\n}\n"
  302.                "\n"
  303.                "LONG OpenWnd( struct Gadget *GList, struct TagItem WTags[], struct Window **Wnd )\n"
  304.                "{\n"
  305.                "\tUWORD\t\ttc;\n" );
  306.  
  307.     if( IE->SrcFlags & FONTSENSITIVE )
  308.     FPuts( Files->Std, "\tUWORD\t\tww, wh, oldww, oldwh;\n" );
  309.  
  310.     FPuts( Files->Std, "\n\tif( GList ) {\n"
  311.                "\t\ttc = 0;\n"
  312.                "\t\twhile( WTags[ tc ].ti_Tag != WA_Gadgets ) tc++;\n"
  313.                "\t\tWTags[ tc ].ti_Data = (ULONG)GList;\n"
  314.                "\t}\n\n" );
  315.  
  316.     if( IE->SrcFlags & FONTSENSITIVE )
  317.     FPuts( Files->Std, "\tww = ScaleX( WTags[ WT_WIDTH  ].ti_Data ) + XOffset + Scr->WBorRight;\n"
  318.                "\twh = ScaleY( WTags[ WT_HEIGHT ].ti_Data ) + YOffset + Scr->WBorBottom;\n"
  319.                "\n"
  320.                "\tif(( WTags[ WT_LEFT ].ti_Data + ww ) > Scr->Width  )\n"
  321.                "\t\tWTags[ WT_LEFT ].ti_Data = Scr->Width  - ww;\n"
  322.                "\tif(( WTags[ WT_TOP  ].ti_Data + wh ) > Scr->Height )\n"
  323.                "\t\tWTags[ WT_TOP  ].ti_Data = Scr->Height - wh;\n"
  324.                "\n"
  325.                "\toldww = WTags[ WT_WIDTH  ].ti_Data;\n"
  326.                "\toldwh = WTags[ WT_HEIGHT ].ti_Data;\n"
  327.                "\tWTags[ WT_WIDTH  ].ti_Data = ww;\n"
  328.                "\tWTags[ WT_HEIGHT ].ti_Data = wh;\n\n" );
  329.  
  330.     FPuts( Files->Std, "\tWTags[8].ti_Data = (ULONG)Scr;\n"
  331.                "\n\t*Wnd = OpenWindowTagList( NULL, &WTags[0] );\n\n" );
  332.  
  333.     if( IE->SrcFlags & FONTSENSITIVE )
  334.     FPuts( Files->Std, "\tWTags[ WT_WIDTH  ].ti_Data = oldww;\n"
  335.                "\tWTags[ WT_HEIGHT ].ti_Data = oldwh;\n\n" );
  336.  
  337.     FPuts( Files->Std, "\tif(!( *Wnd ))\n"
  338.                "\t\treturn( 4L );\n\n"
  339.                "\tGT_RefreshWindow( *Wnd, NULL );\n"
  340.                "\treturn( 0L );\n}\n"
  341.                "\n"
  342.                "void CloseWnd( struct Window **Wnd, struct Gadget **GList, struct Menu **Mn )\n"
  343.                "{\n"
  344.                "\tif( Mn ) {\n"
  345.                "\t\tif( *Wnd )\n"
  346.                "\t\t\tClearMenuStrip( *Wnd );\n\n"
  347.                "\t\tFreeMenus( *Mn );\n"
  348.                "\t\t*Mn = NULL;\n"
  349.                "\t}\n"
  350.                "\tif( *Wnd ) {\n"
  351.                "\t\tCloseWindow( *Wnd );\n"
  352.                "\t\t*Wnd = NULL;\n"
  353.                "\t}\n"
  354.                "\tif( GList ) {\n"
  355.                "\t\tFreeGadgets( *GList );\n"
  356.                "\t\t*GList = NULL;\n"
  357.                "\t}\n"
  358.                "}\n"
  359.                "\n"
  360.                "struct Gadget *MakeGadgets( struct Gadget **GList, struct Gadget *Gads[],\n"
  361.                "\tstruct NewGadget NGad[], UWORD GTypes[], ULONG GTags[], UWORD CNT )\n"
  362.                "{\n"
  363.                "\tstruct Gadget\t\t*g;\n"
  364.                "\tUWORD\t\t\tlc, tc;\n"
  365.                "\tstruct NewGadget\tng;\n\n"
  366.                "\tif(!( g = CreateContext( GList )))\n"
  367.                "\t\treturn( -1 );\n\n"
  368.                "\tfor( lc = 0, tc = 0; lc < CNT; lc++ ) {\n\n"
  369.                "\t\tCopyMem(( char * )&NGad[ lc ], ( char * )&ng, ( long )sizeof( struct NewGadget ));\n"
  370.                "\t\tng.ng_VisualInfo = VisualInfo;\n" );
  371.  
  372.     if( IE->SrcFlags & FONTSENSITIVE )
  373.     FPuts( Files->Std, "\t\tng.ng_TextAttr = Font;\n"
  374.                "\t\tng.ng_LeftEdge = XOffset + ScaleX( ng.ng_LeftEdge );\n"
  375.                "\t\tng.ng_TopEdge  = YOffset + ScaleY( ng.ng_TopEdge  );\n"
  376.                "\t\tng.ng_Width    = ScaleX( ng.ng_Width  );\n"
  377.                "\t\tng.ng_Height   = ScaleY( ng.ng_Height );\n" );
  378.     else
  379.     FPuts( Files->Std, "\t\tng.ng_TopEdge  += YOffset;\n"
  380.                "\t\tng.ng_LeftEdge += XOffset;\n" );
  381.  
  382.     FPuts( Files->Std, "\t\tGads[ lc ] = g = CreateGadgetA((ULONG)GTypes[ lc ], g, &ng, (struct TagItem *)>ags[ tc ] );\n\n"
  383.                "\t\twhile( GTags[ tc ] )\n"
  384.                "\t\t\ttc += 2;\n"
  385.                "\t\ttc++;\n\n"
  386.                "\t\tif( !g )\n"
  387.                "\t\t\treturn( -2 );\n"
  388.                "\t}\n\n"
  389.                "\treturn( g );\n"
  390.                "}\n" );
  391. }
  392. ///
  393.  
  394. /// WriteGBanksHandling
  395. void WriteGBanksHandling( struct GenFiles *Files, struct IE_Data *IE )
  396. {
  397.     struct WindowInfo  *wnd;
  398.  
  399.     for( wnd = IE->win_list.mlh_Head; wnd->wi_succ; wnd = wnd->wi_succ )
  400.     if( wnd->wi_NumGBanks ) {
  401.  
  402.         FPuts( Files->XDef, "extern void AddGadgetBank( struct Window *, struct WindowBanks *, struct Gadget * );\n"
  403.                 "extern void RemGadgetBank( struct Window *, struct WindowBanks *, struct Gadget * );\n" );
  404.  
  405.         FPuts( Files->Std, "\nvoid AddGadgetBank( struct Window *Wnd, struct WindowBanks *WindowBanks, struct Gadget *Bank )\n"
  406.                    "{\n"
  407.                    "\tWindowBanks->Banks[ WindowBanks->Count++ ] = Bank;\n\n"
  408.                    "\tAddGList( Wnd, Bank, (UWORD)~0, -1, NULL );\n"
  409.                    "\tRefreshGadgets( Bank, Wnd, NULL );\n"
  410.                    "}\n\n"
  411.                    "void RemGadgetBank( struct Window *Wnd, struct WindowBanks *WindowBanks, struct Gadget *Bank )\n"
  412.                    "{\n"
  413.                    "\tUWORD   ReAttach = WindowBanks->Count - 1;\n\n"
  414.                    "\twhile( WindowBanks->Count > 0 ) {\n"
  415.                    "\t\tRemoveGList( Wnd, WindowBanks->Banks[ --WindowBanks->Count ], -1 );\n"
  416.                    "\t}\n\n"
  417.                    "\twhile( WindowBanks->Count < ReAttach ) {\n"
  418.                    "\t\tstruct Gadget *Bnk;\n\n"
  419.                    "\t\tif(( Bnk = WindowBanks->Banks[ WindowBanks->Count ]) != Bank ) {\n"
  420.                    "\t\t\tAddGList( Wnd, Bnk, (UWORD)~0, -1, NULL );\n"
  421.                    "\t\t\tWindowBanks->Banks[ WindowBanks->Count++ ] = Bnk;\n"
  422.                    "\t\t}\n"
  423.                    "\t}\n"
  424.                    "}\n\n" );
  425.         break;
  426.     }
  427. }
  428. ///
  429.  
  430. /// WriteRender
  431. void WriteRender( struct GenFiles *Files, struct IE_Data *IE )
  432. {
  433.     struct WindowInfo      *wnd;
  434.     struct BevelBoxNode    *box;
  435.     WORD                    x, y;
  436.  
  437.     for( wnd = IE->win_list.mlh_Head; wnd->wi_succ; wnd = wnd->wi_succ ) {
  438.     if( wnd->wi_NeedRender ) {
  439.  
  440.         FPrintf( Files->XDef, "extern void %sRender( void );\n", wnd->wi_Label );
  441.  
  442.         FPrintf( Files->Std, "\nvoid %sRender( void )\n{\n", wnd->wi_Label );
  443.  
  444.         if( IE->SrcFlags & FONTSENSITIVE ) {
  445.  
  446.         if( wnd->wi_NumImages )
  447.             FPuts( Files->Std, "\tstruct Image\t\tim;\n"
  448.                        "\tstruct Image\t\t*imp;\n" );
  449.  
  450.         if( wnd->wi_NumTexts )
  451.             FPuts( Files->Std, "\tstruct IntuiText\tit;\n" );
  452.  
  453.         if(( wnd->wi_NumImages ) || ( wnd->wi_NumTexts ))
  454.             FPuts( Files->Std, "\tUWORD\t\t\tc;\n" );
  455.         }
  456.  
  457.         IE->win_info = wnd;
  458.         ( *IE->IEXSrcFun->RenderMinusZero )( Files );
  459.  
  460.         for( box = wnd->wi_Boxes.mlh_Head; box->bb_Next; box = box->bb_Next ) {
  461.         x = box->bb_Left - IE->ScreenData->XOffset;
  462.         y = box->bb_Top  - IE->ScreenData->YOffset;
  463.  
  464.         if( IE->SrcFlags & FONTSENSITIVE )
  465.             FPrintf( Files->Std, "\n\tDrawBevelBox( %sWnd->RPort, ScaleX( %ld ) + XOffset, ScaleY( %ld ) + YOffset, ScaleX( %ld ), ScaleY( %ld ),\n"
  466.                      "\t\tGT_VisualInfo, VisualInfo,",
  467.                  wnd->wi_Label, x, y, box->bb_Width, box->bb_Height );
  468.         else
  469.             FPrintf( Files->Std, "\n\tDrawBevelBox( %sWnd->RPort, %ld + XOffset, %ld + YOffset, %ld, %ld,\n"
  470.                      "\t\tGT_VisualInfo, VisualInfo,",
  471.                  wnd->wi_Label, x, y, box->bb_Width, box->bb_Height );
  472.  
  473.         if( box->bb_Recessed )
  474.             FPuts( Files->Std, " GTBB_Recessed, TRUE," );
  475.  
  476.         if( box->bb_FrameType != 1 )
  477.             VFPrintf( Files->Std, " GTBB_FrameType, %ld,", &box->bb_FrameType );
  478.  
  479.         FPuts( Files->Std, " TAG_DONE );\n" );
  480.         }
  481.  
  482.         if( wnd->wi_NumImages ) {
  483.         if( IE->SrcFlags & FONTSENSITIVE ) {
  484.             FPrintf( Files->Std, "\n\timp = &%s_0Image;\n"
  485.                      "\tfor( c = 0; c < %ld; c++ ) {\n"
  486.                      "\t\tCopyMem(( char * )imp, ( char * )&im, ( long )sizeof( struct Image ));\n"
  487.                      "\t\timp = imp->NextImage;\n"
  488.                      "\t\tim.NextImage = NULL;\n"
  489.                      "\t\tim.LeftEdge  = XOffset + ScaleX( im.LeftEdge );\n"
  490.                      "\t\tim.TopEdge   = YOffset + ScaleY( im.TopEdge  );\n"
  491.                      "\t\tDrawImage( %sWnd->RPort, &im, 0, 0 );\n"
  492.                      "\t}\n",
  493.                  wnd->wi_Label, wnd->wi_NumImages, wnd->wi_Label );
  494.         } else {
  495.             FPrintf( Files->Std, "\n\tDrawImage( %sWnd->RPort, &%s_0Image, XOffset, YOffset );\n",
  496.                  wnd->wi_Label, wnd->wi_Label );
  497.         }
  498.         }
  499.  
  500.         if( wnd->wi_NumTexts ) {
  501.         if( IE->SrcFlags & FONTSENSITIVE ) {
  502.             FPrintf( Files->Std, "\n\tfor( c = 0; c < %ld; c++ ) {\n"
  503.                      "\t\tCopyMem(( char * )&%sIText[ c ], ( char * )&it, ( long )sizeof( struct IntuiText ));\n"
  504.                      "\t\tit.ITextFont = Font;\n"
  505.                      "\t\tit.LeftEdge  = XOffset + ScaleX( it.LeftEdge ) - ( IntuiTextLength( &it ) >> 1 );\n"
  506.                      "\t\tit.TopEdge   = YOffset + ScaleY( it.TopEdge  ) - ( Font->ta_YSize >> 1 );\n"
  507.                      "\t\tPrintIText( %sWnd->RPort, &it, 0, 0 );\n"
  508.                      "\t}\n",
  509.                  wnd->wi_NumTexts, wnd->wi_Label, wnd->wi_Label );
  510.         } else {
  511.             FPrintf( Files->Std, "\n\tPrintIText( %sWnd->RPort, %sIText, XOffset, YOffset );\n",
  512.                  wnd->wi_Label, wnd->wi_Label );
  513.         }
  514.         }
  515.  
  516.         ( *IE->IEXSrcFun->RenderPlusZero )( Files );
  517.  
  518.         FPuts( Files->Std, "}\n" );
  519.  
  520.     }
  521.     }
  522. }
  523. ///
  524.  
  525.